from extentions import flaskRedis

class RedisServer():
    def set_str(key, value):
        return flaskRedis.set(key, value)
    
    def get_str(key):
        value = flaskRedis.get(key)
        return value.decode("utf-8")
    
    def set_list_l(key, value):
        return flaskRedis.lpush(key, value)
    
    def set_list_r(key, value):
        return flaskRedis.rpush(key, value)
    
    def get_list(key):
        items = flaskRedis.lrange(key, 0, -1)
        return [item.decode('utf-8') for item in items]
    
    def clear_all():
        return flaskRedis.flushall()